<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/8/20
 * Time: 15:14
 */
class 遍历目录下的全部文件
{

}

function listDir($dir){
    if(is_dir($dir)){
        if ($dh = opendir($dir)){
            while (($file = readdir($dh)) !== false){
                if((is_dir($dir."/".$file)) && $file!="." && $file!=".."){
                    echo "<b><font color='red'>文件名：</font></b>",$file,"<br><hr>";
                    listDir($dir."/".$file."/");
                }else{
                    if($file!="." && $file!=".."){
                        echo $file."<br>";
                    }
                }
            }
            closedir($dh);
        }
    }
}